package org.wzry.wzry;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.wzry.entity.ChessHero;
import org.wzry.entity.Detain;
import org.wzry.entity.Epigraph;
import org.wzry.entity.Fierce;
import org.wzry.entity.Fine;
import org.wzry.entity.Flair;
import org.wzry.entity.Hero;
import org.wzry.entity.NewDerma;
import org.wzry.entity.NewHero;
import org.wzry.entity.NewModel;
import org.wzry.entity.NewSystem;
import org.wzry.entity.Optimize;
import org.wzry.entity.Skill;
import org.wzry.entity.Tone;
import org.wzry.entity.Weapon;
import org.wzry.entity.Wushu;
import org.wzry.util.Wzryinfo;

public class Wzry {
		//C:\Users\Administrator\Desktop\web\tomcat\webapps\wzry\wzry\
		final String path = "C:\\Users\\17299\\Desktop\\王者荣耀-项目\\";
				//"C:\Users\17299\Desktop\王者荣耀-项目\";
	/**
	 * 王者-武器
	 * @return
	 * @throws IOException
	 */
	public List<Weapon> wzrywq()  {
			String texts = "";
				texts = Wzryinfo.info(path+"王者荣耀-武器.txt");
		  //把装备进行分配
		 List<Weapon>  ls = new ArrayList<Weapon>();
		 String[] s = texts.split("#");
         for(String s2 : s){
		String[] s1 = s2.split("@");
		Weapon weapon =	new Weapon(s1[0].substring(3),s1[1].substring(3),s1[2].substring(3),s1[3].substring(3),s1[4].substring(3),s1[5].substring(3));	
		ls.add(weapon);
         }
         return ls;
	}
	
	/**
	 * 王者-英雄
	 * @throws IOException 
	 */
	public List<Hero> wzryyx(){
		List<Hero> ls = new ArrayList<Hero>();
			String texts = "";
				texts = Wzryinfo.info(path+"王者荣耀-英雄.txt");
			for(String text : texts.split("#")) {
				
				String[] s = text.split("@");
					Hero hero = new Hero(s[0].substring(3),s[1].substring(3),s[2].substring(3),s[3].substring(3));
					ls.add(hero);
			}		
			return ls;
	}
	
	/**
	 * 边境-武器
	 * @return
	 */
	public List<Wushu> wushu(){
		List<Wushu> ls = new ArrayList<Wushu>();

			String texts = Wzryinfo.info(path+"王者荣耀-边武.txt");
			for(String s : texts.split("#")) {
				System.out.println(s);
				String[] ss = s.split("@");
				System.out.println(ss.length);
				Wushu wushu = new Wushu(ss[0].substring(3), ss[1].substring(3), ss[2].substring(3), ss[3].substring(3), ss[4].substring(3));
			ls.add(wushu);
			}
		
		return ls;
	}
	
	/**
	 * 英雄-技能
	 * @return
	 */
	public List<Skill> skill(){
		List<Skill> ls = new ArrayList<Skill>();
		String texts = Wzryinfo.info(path+"王者荣耀-技能.txt");
		
		for(String s : texts.split("#")) {
			String[] ss = s.split("@");
			Skill skill = new Skill(ss[0].substring(3), ss[1].substring(3), ss[2].substring(2), ss[3].substring(3));
			ls.add(skill);
		}
		
		return ls;
	}
	
	/**
	 * 铭文
	 * @return
	 */
	public List<Epigraph> epigraph(){		
		List<Epigraph> ls = new ArrayList<Epigraph>();
		String texts = Wzryinfo.info(path+"王者荣耀-铭文.txt");
		for(String s : texts.split("#")) {
			String[] ss = s.split("@");
			Epigraph epigraph = new Epigraph(ss[0].substring(3), ss[1].substring(3), ss[2].substring(3), ss[3].substring(3), ss[4].substring(3));
			ls.add(epigraph);
		}
		
		return ls;
	}
	
	
	/**
	 * 获取新英雄
	 * @return
	 */
	public List<NewHero> newHero(){
		List<NewHero> ls = new ArrayList<NewHero>();
		String texts = Wzryinfo.info(path+"王者荣耀-新英雄.txt");
		for(String s : texts.split("#")) {
			String[] ss = s.split("@");
			NewHero newhero = new NewHero(ss[0].substring(3), ss[1].substring(3), ss[2].substring(3), ss[3].substring(3));
			ls.add(newhero);
			
		}
		
		return ls;
	}
	
	/**
	 * 新皮肤
	 * @return
	 */
	public List<NewDerma> newderma(){
		List<NewDerma> ls = new ArrayList<NewDerma>();
		String texts = Wzryinfo.info(path+"王者荣耀-新皮肤.txt");
		
		for(String s : texts.split("#")) {
			String[] ss = s.split("@");
			NewDerma newderma = new NewDerma(ss[0].substring(3), ss[1].substring(3), ss[2].substring(3));
		ls.add(newderma);
		}
		
		return ls;
	}
	
	/**
	 * 英雄调整
	 * @return
	 */
	public List<Tone> tone(){
		List<Tone> ls = new ArrayList<Tone>();
		String texts = Wzryinfo.info(path+"王者荣耀-调英.txt");
		for(String s : texts.split("#")) {
			String[] ss = s.split("@");
			Tone tone = new Tone(ss[0].substring(3), ss[1].substring(3), ss[2].substring(3), ss[3].substring(3));
			ls.add(tone);
		}
		return ls;
		
	}
	
	/**
	 * 新模式
	 * @return
	 */
	public List<NewModel> model(){
		List<NewModel> ls = new ArrayList<NewModel>();
		String texts = Wzryinfo.info(path+ "王者荣耀-新模.txt");
		for(String s : texts.split("#")) {
			String[] ss = s.split("@");
			NewModel  model = new NewModel(ss[0].substring(3), ss[1].substring(3), ss[2].substring(3), ss[3].substring(3)); 
			ls.add(model);
		}
		return ls;
	}
	
	/**
	 * 新系统
	 * @return
	 */
	public List<NewSystem> newsystem(){
		List<NewSystem> ls = new ArrayList<NewSystem>();
		String texts = Wzryinfo.info(path+ "王者荣耀-新系.txt");
		for(String s : texts.split("#")) {
			String[] ss = s.split("@");
			NewSystem newsystem = new NewSystem(ss[0].substring(3), ss[1].substring(3), ss[2].substring(3), ss[3].substring(3));
			ls.add(newsystem);
		}
		
		return ls;		
	}
	
	/**
	 * 优化
	 */
	public List<Optimize> optimize(){
		List<Optimize> ls = new ArrayList<Optimize>();
		String texts = Wzryinfo.info(path+"王者荣耀-优化.txt");
		for(String s : texts.split("#")) {
			String[] ss = s.split("@");
			Optimize  optimize = new Optimize(ss[0].substring(3), ss[1].substring(3), ss[2].substring(3), ss[3].substring(3));
			ls.add(optimize);
		}
		return ls;		
	}
	
	/**
	 * 美术
	 * @return
	 */
	public List<Fine> fine(){
		List<Fine> ls = new ArrayList<Fine>();
		String texts = Wzryinfo.info(path+"王者荣耀-美术.txt");
		for(String s : texts.split("#")) {
			String[] ss = s.split("@");
			Fine fine = new Fine(ss[0].substring(3), ss[1].substring(3), ss[2].substring(3), ss[3].substring(3));
			ls.add(fine);
		}
		
		return ls;
	}
	
	/**
	 * 棋武器
	 * @return
	 */
	public List<Fierce> fierce(){
		List<Fierce> ls = new ArrayList<Fierce>();
		String texts = Wzryinfo.info(path+"王者荣耀-棋武.txt");
		for(String s : texts.split("#")) {
			String[] ss = s.split("@");
			if(ss.length == 6) {
				Fierce fierce = new Fierce(ss[0].substring(3), ss[1].substring(3), ss[2].substring(3), ss[3].substring(3), ss[4].substring(3), ss[5].substring(3));
				ls.add(fierce);
			}
			
		}
		
		return ls;
	}
	
	/**
	 * 模拟战-天赋
	 * @return
	 */
	
	public List<Flair> flair(){
		List<Flair> ls = new ArrayList<Flair>();
		String texts = Wzryinfo.info(path + "王者荣耀-棋赋.txt");
		for(String s : texts.split("#")) {
			
			String[] ss = s.split("@");
			Flair flair = new Flair(ss[0].substring(3), ss[1].substring(3), ss[2].substring(3));
			ls.add(flair);
		}
		
		return ls;		
	}
	
	/**
	 * 模拟战-羁绊
	 * @return
	 */
	public List<Detain> detain(){		
		List<Detain> ls = new ArrayList<Detain>();
		String texts = Wzryinfo.info(path + "王者荣耀-棋羁.txt");
		for(String s : texts.split("#")) {
			String[] ss = s.split("@");
			Detain detain = new Detain(ss[0].substring(3), ss[1].substring(3), ss[2].substring(3));
			ls.add(detain);
		}
		
		return ls;
	}
	
	/**
	 * 模拟战-英雄
	 * @return
	 */
	public List<ChessHero> chesshero(){
		List<ChessHero> ls = new ArrayList<ChessHero>();
		String texts = Wzryinfo.info(path + "王者荣耀-棋英.txt");
		for(String s :texts.split("#")) {
			String[] ss = s.split("@");
			System.out.println(ss.length);
			if(ss.length == 14) {
				ChessHero chesshero = new ChessHero(ss[0].substring(3),ss[1].substring(3),ss[2].substring(3),ss[3].substring(3),ss[4].substring(3),ss[5].substring(3),ss[6].substring(5),ss[7].substring(5),ss[8].substring(3),ss[9],ss[10].substring(3),ss[11],ss[12].substring(3),ss[13]);
				ls.add(chesshero);	
			}
		}
		return ls;
	}
	
}
